import App from './App'
import uviewPlus from 'uview-plus'
/* 全局挂载请求库 */
import GraceRequest from '@/Grace6/js/request.js'
uni.gRequest = GraceRequest;

// #ifdef VUE3
import { createSSRApp } from 'vue'
let exists = ["class_role","employee_role","flow_role","driver"]
// 三个参数 1维修班长	class_role 2 维修工	employee_role 3 维修作业长	flow_role 4 驾驶员	driver
const hasPers = (...rs)=>{
	if(!uni.$roles){
		let roles = uni.getStorageSync("roles")
		let rolesData = JSON.parse(roles)
		uni.$roles = rolesData.map(item=>item.value)
	}
	let req  =false 
	for (let s of rs) {
		if(uni.$roles.includes(s)){
			req = true
			return req
		}
	}
	return req
}
uni.$hasPers = hasPers

export function createApp() {
  const app = createSSRApp(App)
  app.config.globalProperties.$hasPers = hasPers; // 挂载到全局属性上
  app.use(uviewPlus)
  return {
    app
  }
}
// #endif
